package com.marshall.scstudy.controller;

import com.marshall.scstudy.common.CommonResult;
import com.marshall.scstudy.entities.Payment;
import com.marshall.scstudy.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by
 *
 * @author : Marshall
 * @datetime: 2021/11/4 10:55
 */
@RestController
@Slf4j
public class OrderFeignController {
    @Autowired
    PaymentFeignService paymentFeignService;


    @GetMapping("/consumer/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/consumer/payment/feignTimeout")
    public String payMentFeignTimeOut(){
        //openfeign-ribbon，客户端默认等待1秒钟
        return paymentFeignService.payMentFeignTimeOut();
    }
}
